home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / iqb9107.zip / CANCELIT.BAS next >
BASIC Source File  |  1991-06-27  |  1KB  |  43 lines

  1. ' CancelIt.BAS
  2. ' Demonstration of the PRINT spooler CANCEL operation
  3.  
  4. ' $INCLUDE: 'QB.BI'
  5.  
  6. ' Declare the variables needed for spool operations
  7.  
  8. DIM SpoolFile AS STRING * 64
  9. DIM InRegs AS RegType, OutRegs AS RegType
  10.  
  11. ' Check to see if the PRINT.COM spooler is loaded
  12.  
  13. InRegs.AX = &H100      ' spooler load residency request
  14. Interrupt &H2F, InRegs, InRegs
  15. AL = InRegs.AX MOD 256
  16. IF AL = 0 THEN
  17.   PRINT "PRINT is not loaded."
  18.   END
  19. END IF
  20.  
  21. ' Ask the user for the name of a file to cancel
  22.  
  23. LINE INPUT "Enter the filename to cancel >", FileName$
  24. IF LEN(FileName$) = 0 THEN END   ' nothing to do, so exit
  25.  
  26. SpoolFile = LTRIM$(RTRIM$(UCASE$(FileName$))) + CHR$(0)
  27.  
  28. ' Cancel the file
  29. InRegs.AX = &H102
  30. InRegs.DX = VARPTR(SpoolFile)
  31. Interrupt &H2F, InRegs, OutRegs
  32.  
  33. ' Isolate the status of the cancel operation
  34. CanceledOK% = NOT OutRegs.flags AND 1
  35. IF CanceledOK% THEN
  36.   PRINT FileName$; " has been canceled from the queue."
  37. ELSE
  38.   AL = OutRegs.AX MOD 256
  39.   PRINT "Could not cancel "; FileName$; " error code is "; AL
  40. END IF
  41. END
  42.  
  43.